package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



import factory.UserManagerFactory;
import pojo.User;
import service.UserManager;


public class findallServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private UserManager um=UserManagerFactory.getUserManagerInstance(); 

   
    public findallServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<User> users=um.findAllUsers();
		for(User u:users){
			System.out.println(u.getId()+"..."+u.getName());
		}
		request.setAttribute("us", users);
		request.getRequestDispatcher("role/userList.jsp").forward(request, response);
	}

	
}
